package com.midian.action.mc.activity;

import java.util.List;

import javax.annotation.Resource;

import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Controller;

import com.midian.action.mc.common.AjaxAction;
import com.midian.common.annotation.FunctionAnnotationOverride;
import com.midian.common.dao.OrderHelper;
import com.midian.common.exception.BizException;
import com.midian.common.pager.Pager;
import com.midian.model.activity.ActivityUser;
import com.midian.model.activity.vo.ActivityUserVO;
import com.midian.service.activity.IActivityUserService;

/**
 * 活动用户（报名）Action
 * @author Mengfh
 *
 */
@Scope("prototype")
@Controller("activityUserAction")
@FunctionAnnotationOverride(isAction = true, auth = "活动报名管理")
public class ActivityUserAction extends AjaxAction<ActivityUserVO> {
	/**活动用户（报名）实体*/
	private ActivityUserVO entity;
	/**活动用户（报名）实体列表*/
	private List<ActivityUserVO> rows;
	/**活动用户（报名）业务*/
	private IActivityUserService activityUserService;
	/**活动用户报名列表*/
	private List<ActivityUser> activityUsersList;
	
	
	public List<ActivityUser> getActivityUsersList() {
		return activityUsersList;
	}
	public void setActivityUsersList(List<ActivityUser> activityUsersList) {
		this.activityUsersList = activityUsersList;
	}
	@Resource(name = "activityUserService")
	public void setActivityUserService(IActivityUserService activityUserService) {
		this.activityUserService = activityUserService;
	}
	@Override
	protected ActivityUserVO dytEntity() {
		if(this.entity == null) {
			this.entity = new ActivityUserVO();
		}
		return getEntity();
	}
	@Override
	protected void dyEntity(ActivityUserVO t) {
		setEntity(t);
	}
	@Override
	public void setRows(List<ActivityUserVO> rows) {
		this.rows = rows;
	}
	@Override
	public List<ActivityUserVO> getRows() {
		return rows;
	}
	public ActivityUserVO getEntity() {
		return entity;
	}
	public void setEntity(ActivityUserVO entity) {
		this.entity = entity;
	}
	
	@Override
	public String showList() {
		if(this.pager == null) {
			this.pager = new Pager();
		}
		List<OrderHelper> order = getOrder();
		try {
			this.setRows(activityUserService.showList(entity, pager,order));
			List<ActivityUserVO> rows = this.getRows();
			if (!rows.isEmpty()) {
				setPager(rows.get(0).getPager());
			}
		} catch (BizException e) {
			getError(e);
		}
		return SUCCESS;
	}
	
	

	


}
